﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SanctusSoftware.Music.Chords
{
    public class Note
    {

        #region Constructor

        public Note(int index, string[] noteNames)
        {
            this.index = index;
            this.noteNames = noteNames;
        }

        #endregion

        #region Public Properties

        private int index;
        
        public int Index
        {
            get { return index; }
        }

        private string[] noteNames;
        
        public string[] NoteNames
        {
            get { return noteNames; }
        }
	

        #endregion

        #region Public Methods

        public bool HasNoteName(string noteName)
        {
            
            foreach (string n in noteNames)
            {
                if (n.ToUpper().Trim() == noteName.ToUpper().Trim())
                {
                    return true;
                }
            }

            return false;

        }

        public string GetNoteNameFromNoteLetter(string noteLetter)
        {
            foreach (string n in noteNames)
            {
                if (n.ToUpper().Trim().Substring(0,1) == noteLetter.ToUpper().Trim().Substring(0,1))
                {
                    return n;
                }
            }

            throw new Exception("No note name found for note letter " + noteLetter);
        }

        #endregion

    }
}
